package com.net.framework.help.utils;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import java.io.InputStream;

/**
 * Author：xiaobin.zhang
 * Email：154722566@qq.com
 * Date：2016/10/15 9:59
 * Desc：<--资源图片转化Bitamp-->
 */
public class ConversionBitampUtil {

    public static Bitmap conversionBitamp(Context context, int res) {
        BitmapFactory.Options opt = new BitmapFactory.Options();
        opt.inPreferredConfig = Bitmap.Config.RGB_565;
        opt.inPurgeable = true;
        opt.inInputShareable = true;
        InputStream is = context.getResources().openRawResource(res);
        return BitmapFactory.decodeStream(is, null, opt);
    }
}
